Conventionally, an inverter device that detects the temperature of a switching element and changes a carrier frequency according to the detected temperature is known. The inverter device is known to lower the carrier frequency in stages from an initially set frequency when the detected temperature is at least an upper limit reference temperature, and to return the carrier frequency to the initially set frequency when the detected temperature is equal to or lower than a lower limit reference temperature (refer to Patent Document 1 below).